package com.vooda.business_admin.config;


import com.vooda.business_admin.common.DateFormater;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by Charlee
 * on 2017/8/2.
 */
@ControllerAdvice
public class WebMvcConfig extends WebMvcConfigurerAdapter {


    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //首页
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/login").setViewName("login");
        registry.addViewController("/management").setViewName("layout");

        //管理员
        registry.addViewController("/management/manager").setViewName("manager/manager_list");
        registry.addViewController("/management/user").setViewName("user/user_list");
        registry.addViewController("/management/home_page").setViewName("homePage/home_page_list");
        registry.addViewController("/management/market").setViewName("homePage/market_list");
        registry.addViewController("/management/store").setViewName("homePage/store_list");
        registry.addViewController("/management/ticket").setViewName("homePage/ticket_list");


        super.addViewControllers(registry);
    }

    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverter(new DateFormater());
    }
}
